package writer;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-10-01
 * Time: 18:56
 */
public class FileWriterTest1 {


    public static void FileWriterDemo1() throws IOException {
        char[] buffer = {'1','2','f','8'};
        try(FileWriter fileWriter = new FileWriter("e://demo.txt")){
            //int
            //fileWriter.write('a');
            //string
            //fileWriter.write("asdfghjkertyuicvbndfghjfghhjk");
//            //char[]
              //fileWriter.write(buffer);
//            //str,off,len
             //String str = "hello,world11";
             // fileWriter.write(str);
//            //char[],off,len
            fileWriter.write(buffer,0,2);
            fileWriter.flush();
        }

    }

    public static void main(String[] args) throws IOException {

        FileWriterDemo1();
    }


}
